package cn.com.huzo.model.entities.financial;

import com.fasterxml.jackson.annotation.JsonFormat;
import huzofw.model.entities.BaseEntity;
import huzofw.model.entities.IAggregateRoot;
import java.io.Serializable;
import java.util.Date;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * 会计期实体类
 *
 * @author 吴旭
 */
public class AccoutingPeriodEntity extends BaseEntity implements Serializable, IAggregateRoot {

    private static final long serialVersionUID = 6269065540632006080L;
    private String AccoutingPeriodId;
    private String ApYear;                      // 会计期年度
    private Date StartDate;                     // 开始日期
    private Date EndDate;                       // 结束日期

    public String getAccoutingPeriodId() {
        return AccoutingPeriodId;
    }

    public void setAccoutingPeriodId(String AccoutingPeriodId) {
        this.AccoutingPeriodId = AccoutingPeriodId;
    }

    public String getApYear() {
        return ApYear;
    }

    public void setApYear(String ApYear) {
        this.ApYear = ApYear;
    }

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    public Date getStartDate() {
        return StartDate;
    }

    public void setStartDate(Date StartDate) {
        this.StartDate = StartDate;
    }

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    public Date getEndDate() {
        return EndDate;
    }

    public void setEndDate(Date EndDate) {
        this.EndDate = EndDate;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof AccoutingPeriodEntity)) {
            return false;
        }

        final AccoutingPeriodEntity that = (AccoutingPeriodEntity) o;

        return new EqualsBuilder()
                .append(this.getAccoutingPeriodId(), that.getAccoutingPeriodId())
                .isEquals();
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public int hashCode() {
        int result = 17;
        result = 31 * result + getAccoutingPeriodId().hashCode();

        return result;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public String toString() {
        //ToStringBuilder sb = new ToStringBuilder(this, ToStringStyle.DEFAULT_STYLE)
        //    .append("ColourCnName", this.ColourCnName);

        //return sb.toString();
        return ToStringBuilder.reflectionToString(this);
    }
}
